//
//  NSObject+SSKExtension.m
//  SSKKit
//
//  Created by Apple on 2016/12/25.
//  Copyright © 2016年 LiuYing. All rights reserved.
//

#import "NSObject+SSKExtension.h"

@implementation NSObject (SSKExtension)

#pragma mark -
#pragma mark - Class Method

+ (void)ssk_dispatchAfter:(CGFloat)after
                   delays:(void (^)(void))delays {
    
    dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW,((int64_t)(after * NSEC_PER_SEC)));
    dispatch_queue_t queue = dispatch_get_main_queue();
    dispatch_block_t block = ^{ if (delays) delays(); };
    
    dispatch_after(time, queue, block);
}

+ (void)ssk_dispatch_async_main:(dispatch_block_t)block {
    dispatch_async(dispatch_get_main_queue(), block);
}

#pragma mark -
#pragma mark - Instance Method

- (void)ssk_dispatchAfter:(CGFloat)after
                   delays:(void (^)(void))delays {
    [[self class] ssk_dispatchAfter:after delays:delays];
}

- (void)ssk_dispatch_async_main:(dispatch_block_t)block {
    [[self class] ssk_dispatch_async_main:block];
}

@end
